package com.atguigu.gmall.all.controller;

import com.atguigu.gmall.common.result.Result;
import com.atguigu.gmall.order.client.OrderFeignClient;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

import javax.annotation.Resource;

@Controller
public class PaymentController {

    @Resource
    private OrderFeignClient orderFeignClient;

    //提交订单转发到支付页面
    @GetMapping("/pay.html")
    public String toPayment(Long orderId, Model model){

        Result result = orderFeignClient.getOrderInfo(orderId);
        model.addAttribute("orderInfo",result.getData());
        return "payment/pay";
    }

    //支付完成转发到成功页面
    @GetMapping("/pay/success.html")
    public String success(){
        return "payment/success";
    }
}
